#include "moparse.h"
#include <iostream>
#include <string>

int main(int argc, char* argv[]) {
    if (argc != 3) {
        std::cerr << "Usage: " << argv[0] << " <file_list> <output_file>" << std::endl;
        return 1;
    }
    
    std::string fileList = argv[1];
    std::string outputFile = argv[2];
    
    std::cout << "Debug test started" << std::endl;
    std::cout << "File list: " << fileList << std::endl;
    std::cout << "Output file: " << outputFile << std::endl;
    
    VerilogParser parser;
    
    std::cout << "Starting to parse file list..." << std::endl;
    bool result = parser.parseVerilogFileList(fileList, "");
    
    if (result) {
        std::cout << "Parsing completed successfully" << std::endl;
        std::cout << "Saving to MODB file..." << std::endl;
        if (parser.saveToModb(outputFile)) {
            std::cout << "MODB file saved successfully" << std::endl;
        } else {
            std::cerr << "Failed to save MODB file" << std::endl;
            return 1;
        }
    } else {
        std::cerr << "Failed to parse file list" << std::endl;
        return 1;
    }
    
    return 0;
}